<template>
  <div class="DetailsBasicInformation">
    <Form @submit.native.prevent>
      <Row :gutter="20">
        <Col span="12" v-if="unlocking('客户管理', '2000045')">
          <FormItem label="名下房产：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'PropertyUnderNameVal'">{{customerPortrait.houseNum == '0' ? '无房产' : customerPortrait.houseNum == '1' ? '有1套' : customerPortrait.houseNum == '2' ? '有2套' : customerPortrait.houseNum == '3' ? '有3套' : customerPortrait.houseNum == '4' ? '有4套' : customerPortrait.houseNum == '5' ? '有5套' : customerPortrait.houseNum == '-1' ? '有5套以上' : '-'}}</span>
            <Select id="formDealWithRefs" v-if="type == 'PropertyUnderNameVal'" filterable v-model="PropertyUnderNameVal" style="width:200px" placeholder="请选择名下房产">
              <Option v-for="(item, index) in PropertyUnderNameList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'PropertyUnderNameVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('PropertyUnderNameVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000046')">
          <FormItem label="现居住区域：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'CurrentLivingArea'">{{customerPortrait.more&&customerPortrait.more.livingArea || '-'}}</span>
            <provinceCityArea id="formDealWithRefs" v-if="type == 'CurrentLivingArea'" type="currentLiving" @provinceCityDistrictFun="provinceCityDistrictFun" :InquireData="customerPortrait.livingArea"></provinceCityArea>
            <img v-if="type != 'CurrentLivingArea' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('CurrentLivingArea')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000047')">
          <FormItem label="现居住小区：" @keyup.enter.native="keyupEnterFun('CurrentResidentialArea')">
            <span v-if="type != 'CurrentResidentialArea'">{{customerPortrait.nowLiveHouse || '-'}}</span>
            <Input id="formDealWithRefs" v-if="type == 'CurrentResidentialArea'" v-model="CurrentResidentialArea" placeholder="请输入现居住小区" style="width: 200px" />
            <img v-if="type != 'CurrentResidentialArea' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('CurrentResidentialArea')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000048')">
          <FormItem label="现居所来源：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'SourceCurrentResidenceVal'">{{customerPortrait.nowLiveSource == 1 ? '自购' : customerPortrait.nowLiveSource == 2 ? '租住' : '-'}}</span>
            <Select id="formDealWithRefs" v-if="type == 'SourceCurrentResidenceVal'" filterable v-model="SourceCurrentResidenceVal" style="width:200px" placeholder="请选择现居所来源" >
              <Option v-for="(item, index) in SourceCurrentResidenceList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'SourceCurrentResidenceVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('SourceCurrentResidenceVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000049')">
          <FormItem label="现居所格局：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'CurrentResidencePatternVal'">{{customerPortrait.nowHouseType == 1 ? '一室一卫' : customerPortrait.nowHouseType == 2 ? '二室一卫' : customerPortrait.nowHouseType == 3 ? '三室一卫' : customerPortrait.nowHouseType == 4 ? '3室2卫' : customerPortrait.nowHouseType == 5 ? '四室两卫及以上' : '-'}}</span>
            <Select id="formDealWithRefs" v-if="type == 'CurrentResidencePatternVal'" filterable v-model="CurrentResidencePatternVal" style="width:200px" placeholder="请选择现居所格局" >
              <Option v-for="(item, index) in CurrentResidencePatternList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'CurrentResidencePatternVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('CurrentResidencePatternVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000050')">
          <FormItem label="工作区域：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'workingArea'">{{customerPortrait.more&&customerPortrait.more.workingArea || '-'}}</span>
            <provinceCityArea id="formDealWithRefs" v-if="type == 'workingArea'" type="workingArea" @provinceCityDistrictFun="provinceCityDistrictFun" :InquireData="customerPortrait.workingArea"></provinceCityArea>
            <img v-if="type != 'workingArea' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('workingArea')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000051')">
          <FormItem label="职业：" @keyup.enter.native="keyupEnterFun('ProfessionVal')">
            <span v-if="type != 'ProfessionVal'">{{customerPortrait.profession || '-'}}</span>
            <Input id="formDealWithRefs" v-if="type == 'ProfessionVal'" v-model="ProfessionVal" placeholder="请输入职业" style="width: 200px" />
            <img v-if="type != 'ProfessionVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('ProfessionVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000061')">
          <FormItem label="职务：" @keyup.enter.native="keyupEnterFun('PositionVla')">
            <span v-if="type != 'PositionVla'">{{customerPortrait.position || '-'}}</span>
            <Input id="formDealWithRefs" v-if="type == 'PositionVla'" v-model="PositionVla" placeholder="请输入职务" style="width: 200px" />
            <img v-if="type != 'PositionVla' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('PositionVla')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000062')">
          <FormItem label="年龄：" @keyup.enter.native="keyupEnterFun('ageVal')">
            <span v-if="type != 'ageVal'">{{customerPortrait.estimateAge || '-'}}</span>
            <Input id="formDealWithRefs" v-if="type == 'ageVal'" :maxlength="3" v-model="ageVal" placeholder="请输入年龄" style="width: 200px" />
            <img v-if="type != 'ageVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('ageVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000060')">
          <FormItem label="身份证号码：" @keyup.enter.native="keyupEnterFun('identificationNumber')">
            <span v-if="type != 'identificationNumber'">{{customerPortrait.card || '-'}}</span>
            <Input id="formDealWithRefs" v-if="type == 'identificationNumber'" v-model="identificationNumber" placeholder="请输入身份证号码" style="width: 200px" />
            <img v-if="type != 'identificationNumber' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('identificationNumber')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000056')">
          <FormItem label="是否限购：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'WhetherToPurchaseVal'">{{customerPortrait.astrict == 1 ? '是' : customerPortrait.astrict == 2 ? '否' : '-'}}</span>
            <Select id="formDealWithRefs" v-if="type == 'WhetherToPurchaseVal'" v-model="WhetherToPurchaseVal" filterable style="width:200px" placeholder="请选择是否限购" >
              <Option v-for="(item, index) in WhetherToPurchaseList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'WhetherToPurchaseVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('WhetherToPurchaseVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000053')">
          <FormItem label="家庭结构：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'familyStructure'">{{customerPortrait.familyStructure == 1 ? '单身' : customerPortrait.familyStructure == 2 ? '夫妻' : customerPortrait.familyStructure == 3 ? '三口之家' : customerPortrait.familyStructure == 4 ? '四口之家' : customerPortrait.familyStructure == 5 ? '三代同堂' : customerPortrait.familyStructure == 6 ? '其他' : '-'}}</span>
            <Select id="formDealWithRefs" v-if="type == 'familyStructure'" v-model="familyStructure" filterable style="width:200px" placeholder="请选择家庭结构" >
              <Option v-for="(item, index) in familyStructureList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'familyStructure' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('familyStructure')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000054')">
          <FormItem label="家庭年收入：" @keyup.enter.native="keyupEnterFun('FamilyIncomeValMin-FamilyIncomeValMax')">
            <span v-if="type != 'FamilyIncomeVal'">{{customerPortrait.familyIncomeMin}}-{{customerPortrait.familyIncomeMax}}万</span>
            <span id="formDealWithRefs" v-if="type == 'FamilyIncomeVal'">
              <Input v-model="FamilyIncomeValMin" style="width:90px" type="number" placeholder="请输入"></Input>
              <span style="margin: 0 6px;">-</span>
              <Input v-model="FamilyIncomeValMax" style="width:90px"  type="number" placeholder="请输入"></Input>
            </span>
            <img v-if="type != 'FamilyIncomeVal' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('FamilyIncomeVal')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000055')">
          <FormItem label="个人年收入：" @keyup.enter.native="keyupEnterFun('PersonalAnnualIncomeMin-PersonalAnnualIncomeMax')">
            <span v-if="type != 'PersonalAnnualIncome'">{{customerPortrait.customerIncomeMin}}-{{customerPortrait.customerIncomeMax}}万</span>
            <span id="formDealWithRefs" v-if="type == 'PersonalAnnualIncome'" >
              <Input v-model="PersonalAnnualIncomeMin" style="width:90px"  type="number" placeholder="请输入"></Input>
              <span style="margin: 0 6px;">-</span>
              <Input v-model="PersonalAnnualIncomeMax" style="width:90px"  type="number" placeholder="请输入"></Input>
            </span>
            <img v-if="type != 'PersonalAnnualIncome' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('PersonalAnnualIncome')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000058')">
          <FormItem label="贷款资格：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'LoanEligibility'">{{customerPortrait.loansQualification | loansQualification}}</span>
            <Select id="formDealWithRefs" v-if="type == 'LoanEligibility'" v-model="LoanEligibility" filterable style="width:200px" placeholder="请选择贷款资格" >
              <Option v-for="(item, index) in LoanEligibilityList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'LoanEligibility' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('LoanEligibility')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '2000057')">
          <FormItem label="购房资格：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'PurchaseQualification'">{{customerPortrait.buyHouseQualification == 1 ? '有' : customerPortrait.buyHouseQualification == 2 ? '无' : '-'}}</span>
            <Select id="formDealWithRefs" v-if="type == 'PurchaseQualification'" v-model="PurchaseQualification" filterable style="width:200px" placeholder="请选择贷款资格" >
              <Option v-for="(item, index) in PurchaseQualificationList" :value="item.val" :key="index">{{ item.name }}</Option>
            </Select>
            <img v-if="type != 'PurchaseQualification' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('PurchaseQualification')" src="@img/edit.png">
          </FormItem>
        </Col>
        <Col span="12" v-if="unlocking('客户管理', '5000023')">
          <FormItem label="特殊描述：" @keyup.enter.native="keyupEnterFun()">
            <span v-if="type != 'SpecialDscription'">{{customerPortrait.specialDscription || "-"}}</span>
             <Input v-if="type == 'SpecialDscription'" v-model="SpecialDscription" type="textarea" :autosize="{minRows: 2,maxRows: 5}" placeholder="请输入特殊描述"></Input>
            <img v-if="type != 'SpecialDscription' && unlocking('客户管理', '3000005')" class="editFeatures" @click="FormDealWithFun('SpecialDscription')" src="@img/edit.png">
          </FormItem>
        </Col>
      </Row>
    </Form>
  </div>
</template>
<script>
  import { customerDetailsInfo, customeruserEdit } from "@/api/customerManagement.js";
  import provinceCityArea from './provinceCityArea'
  export default {
    components: {
      provinceCityArea
    },
    filters:{
      loansQualification(value){
        let flag = "-";
        switch(value - 0){
          case 1:
           flag = "有";
          break;
          case 2:
           flag = "无";
          break;
          case 3:
           flag = "首套";
          break;
          case 4:
           flag = "二套";
          break;
        }
        return flag;
      }
    },
    props: ['servicePersonnelId'],
    data() {
      return {
        portrayalId: '',
        customerPortrait: '',
        type: '',
        PropertyUnderNameVal: '',
        PropertyUnderNameList: [{name: '请选择', val: '-4'}, {name: '无房产', val: '0'}, {name: '有1套', val: '1'}, {name: '有2套', val: '2'}, {name: '有3套', val: '3'}, {name: '有4套', val: '4'}, {name: '有5套', val: '5'}, {name: '有5套以上', val: '-1'}],
        CurrentResidentialArea: '',
        SourceCurrentResidenceVal: '',
        SourceCurrentResidenceList: [{name: '请选择', val: '-4'}, {name: '自购', val: '1'}, {name: '租住', val: '2'}],
        CurrentResidencePatternVal: '',
        CurrentResidencePatternList: [{name: '请选择', val: '-4'}, {name: '1室1卫', val: '1'}, {name: '2室1卫', val: '2'}, {name: '3室1卫', val: '3'}, {name: '3室2卫', val: '4'}, {name: '4室2卫及以上', val: '5'}],
        ProfessionVal: '',
        ageVal: '',
        WhetherToPurchaseVal: '',
        WhetherToPurchaseList: [{name: '请选择', val: '-4'}, {name: '是', val: '1'}, {name: '否', val: '2'}],
        familyStructure: '',
        familyStructureList: [{name: '请选择', val: '-4'}, {name: '单身', val: '1'}, {name: '夫妻', val: '2'}, {name: '三口之家', val: '3'}, {name: '四口之家', val: '4'}, {name: '三代同堂', val: '5'}, {name: '其他', val: '6'}],
        FamilyIncomeValMin: '',
        FamilyIncomeValMax: '',
        PersonalAnnualIncomeMin: '',
        PersonalAnnualIncomeMax: '',
        LoanEligibilityList: [{name: '请选择', val: '-4'}, {name: '有', val: '1'}, {name: '无', val: '2'}],
        LoanEligibility: '',
        PurchaseQualificationList: [{name: '请选择', val: '-4'}, {name: '有', val: '1'}, {name: '无', val: '2'}],
        PurchaseQualification: '',
        PositionVla: '',
        identificationNumber: '',
        workingAreaSSQ: [],
        currentLivingSSQ: []
      }
    },
    methods: {
      // 省市区选择处理
      provinceCityDistrictFun(val) {
        if (val.type == 'workingArea') {
          this.workingAreaSSQ = val.selectVal
        } else if (val.type == 'currentLiving') {
          this.currentLivingSSQ = val.selectVal
        }
      },
      // 编辑功能
      FormDealWithFun(type) {
        if (!this.servicePersonnelId.storeManager) {
          this.$Message.warning('您无操作权限，请联系系统管理员')
          return false
        }
        this.initData()
        this.type = type
      },
      // Input 回车事件
      keyupEnterFun(val) {
        if (val == 'CurrentResidentialArea') {
          if (this.CurrentResidentialArea) {
            if (this.CurrentResidentialArea.length > 10) {
              this.$Message.warning('不可超过10个字符')
              return false
            } else if (!(/^[\a-\z\A-\Z0-9\u4E00-\u9FA5]+$/.test(this.CurrentResidentialArea))) {
              this.$Message.warning('请输入中英文、数字')
              return false
            }
          }
        }
        if (val == 'ProfessionVal' || val == 'PositionVla') {
          if (this[val]) {
            if (this[val].length > 10) {
              this.$Message.warning('不可超过10个字符')
              return false
            } else if (!(/^[\u4e00-\u9fa5_a-zA-Z]+$/.test(this[val]))) {
              this.$Message.warning('请输入中英文')
              return false
            }
          }
        }
        if (val == 'ageVal') {
          if(this.ageVal) {
            if (!(/^[1-9]\d*$/.test(this.ageVal))) {
              this.$Message.warning('请输入正整数')
              return false
            }
          }
        }
        if (val == 'identificationNumber') {
          if(this.identificationNumber) {
            if (!(/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(this.identificationNumber))) {
              this.$Message.warning('请输入正确的身份证号')
              return false
            }
          }
        }
        if (val == 'FamilyIncomeValMin-FamilyIncomeValMax' || val == 'PersonalAnnualIncomeMin-PersonalAnnualIncomeMax') {
          if (val.split('-')[0]) {
            if (!(/^[1-9]\d*$/.test(this[val.split('-')[0]]))) {
              this.$Message.warning('请输入正整数')
              return false
            }  else if (parseFloat(this[val.split('-')[0]]) >= parseFloat(this[val.split('-')[1]])) {
              this.$Message.warning('右侧值必须大于左侧输入值')
              return false
            }
          }
          if (val.split('-')[1]) {
            if (!(/^[1-9]\d*$/.test(this[val.split('-')[1]]))) {
              this.$Message.warning('请输入正整数')
              return false
            }  else if (parseFloat(this[val.split('-')[0]]) >= parseFloat(this[val.split('-')[1]])) {
              this.$Message.warning('右侧值必须大于左侧输入值')
              return false
            }
          }
        }
        let parms = {
          userCustomerId: this.$route.query.userCustomerId,
          buildingId: this.servicePersonnelId.buildingId,
          portrayalId: this.portrayalId,
          houseNum: this.PropertyUnderNameVal == '-4' ? '' : this.PropertyUnderNameVal,
          nowLiveHouse: this.CurrentResidentialArea,
          nowLiveSource: this.SourceCurrentResidenceVal == '-4' ? '' : this.SourceCurrentResidenceVal,
          nowHouseType: this.CurrentResidencePatternVal == '-4' ? '' : this.CurrentResidencePatternVal,
          profession: this.ProfessionVal,
          position: this.PositionVla,
          estimateAge: this.ageVal,
          card: this.identificationNumber,
          astrict: this.WhetherToPurchaseVal == '-4' ? '' : this.WhetherToPurchaseVal != "-"?this.WhetherToPurchaseVal:'',
          familyStructure: this.familyStructure == '-4' ? '' : this.familyStructure,
          familyIncomeMin: this.FamilyIncomeValMin,
          familyIncomeMax: this.FamilyIncomeValMax,
          customerIncomeMin: this.PersonalAnnualIncomeMin,
          customerIncomeMax: this.PersonalAnnualIncomeMax,
          loansQualification: this.LoanEligibility == '-4' ? '' : this.LoanEligibility,
          buyHouseQualification: this.PurchaseQualification == '-4' ? '' : this.PurchaseQualification != "-"?this.PurchaseQualification:'',
        }
        console.log("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",this.workingAreaSSQ,'居住区域-----------------',this.currentLivingSSQ);
        if (this.workingAreaSSQ.length == 3) {
          let workQu = []
          this.workingAreaSSQ.map((item)=>{
            workQu.push(item.value)
          })
          parms.workingArea = workQu.join(",")
        } else {
          parms.workingArea = ''
        }
        if (this.currentLivingSSQ.length == 3) {
          let workQu = []
          this.currentLivingSSQ.map((item)=>{
            workQu.push(item.value)
          })
          parms.livingArea = workQu.join(",")
        } else {
          parms.livingArea = ''
        }
        this.type = ''
        customeruserEdit(parms).then(res=>{
          this.$Message.success('修改成功!');
          this.initData()
        }).catch(err=>{
          this.$Message.error(err)
        })
      },
      // 点击页面
      documentDealWithFun(e) {
        const contextMenuBox = document.getElementById("formDealWithRefs");
        if (!e.target.classList.contains('editFeatures')) {
          if (contextMenuBox){
            if(!contextMenuBox.contains(e.target)) {
              this.keyupEnterFun(this.type)
            }
          }
        }
      },
      // 初始化获取数据
      initData() {
        console.log('this.servicePersonnelId', this.servicePersonnelId)
        // 获取置业报告
        customerDetailsInfo({
          userCustomerId: this.$route.query.userCustomerId
        }).then(res=>{
          console.log("客户画像",res)
          if (res) {
            this.customerPortrait = res
            this.portrayalId = res.portrayalId
            // 修改数据
            this.PropertyUnderNameVal = res.houseNum == '0' ? '0' : res.houseNum == '1' ? '1' : res.houseNum == '2' ? '2' : res.houseNum == '3' ? '3' : res.houseNum == '4' ? '4' : res.houseNum == '5' ? '5' : res.houseNum == '-1' ? '-1' : ''
            this.CurrentResidentialArea = res.nowLiveHouse || ''
            this.SourceCurrentResidenceVal = res.nowLiveSource == 1 ? '1' : res.nowLiveSource == 2 ? '2' : ''
            this.CurrentResidencePatternVal = res.nowHouseType == 1 ? '1' : res.nowHouseType == 2 ? '2' : res.nowHouseType == 3 ? '3' : res.nowHouseType == 4 ? '4' : res.nowHouseType == 5 ? '5' : ''
            this.ProfessionVal = res.profession || ''
            this.PositionVla = res.position || ''
            this.ageVal = res.estimateAge || ''
            this.identificationNumber = res.card || ''
            this.WhetherToPurchaseVal = res.astrict == 1 ? '1' : res.astrict == 2 ? '2' : '-'
            this.familyStructure = res.familyStructure == 1 ? '1' : res.familyStructure == 2 ? '2' : res.familyStructure == 3 ? '3' : res.familyStructure == 4 ? '4' : res.familyStructure == 5 ? '5' : res.familyStructure == 6 ? '6' : ''
            this.FamilyIncomeValMin = res.familyIncomeMin
            this.FamilyIncomeValMax = res.familyIncomeMax
            this.PersonalAnnualIncomeMin = res.customerIncomeMin
            this.PersonalAnnualIncomeMax = res.customerIncomeMax
            this.LoanEligibility = res.loansQualification == 1 ? '1' : res.loansQualification == 2 ? '2' : '0'
            this.PurchaseQualification = res.buyHouseQualification == 1 ? '1' : res.buyHouseQualification == 2 ? '2' : '-'
            if(res.workingArea && res.workingArea != null && res.workingArea.length>0){
              this.workingAreaSSQ = []
              res.workingArea.split(",").map(item =>{
                this.workingAreaSSQ.push({value:item})
              })
            }
            if(res.livingArea && res.livingArea != null && res.livingArea.length>0){
              this.currentLivingSSQ = []
              res.livingArea.split(",").map(item =>{
                this.currentLivingSSQ.push({value:item})
              })
            }
          }
        }).catch(err=>{
          console.log('客户画像', err)
          this.$Message.error(err)
        })
      }
    },
    computed: {

    },
    created() {
    },
    mounted() {
      document.addEventListener('click', this.documentDealWithFun)
    },
    destroyed() {
      document.removeEventListener('click', this.documentDealWithFun)
    },
    watch: {
      servicePersonnelId:{
        handler(newV,oldV){
          // 初始化获取数据
          this.initData()
        },
        deep: true, //深度遍历
        immediate: true //默认false，设置为true会立即执行
      }
    },
  }
</script>
<style lang="scss" scoped>
  .DetailsBasicInformation{
    .ivu-form-item{
      margin-bottom: 4px;
    }
    .editFeatures{
      vertical-align: middle;
      margin-left: 20px;
      cursor: pointer;
      display: inline-block;
    }
  }
</style>
